//
//  NavView.m
//  atlas
//
//  Created by 你好 on 16/12/30.
//  Copyright © 2016年 xyxNav. All rights reserved.
//

#import "NavView.h"

@implementation NavView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self)
    {
        [self configUI];
    }
    return self;
}

-(void)configUI
{
//    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
    //  毛玻璃view 视图
//    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
//    //添加到要有毛玻璃特效的控件中
//    effectView.frame = self.bounds;
//    effectView.alpha = 4.0f;
//    [self addSubview:effectView];
    
    self.backgroundColor=[UIColor colorWithWhite:1.0f alpha:0.85];
    
    self.leftButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:self.leftButton];
    
    self.rightButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:self.rightButton];
    
    self.centerLabel=[UILabel new];
    self.centerLabel.lineBreakMode=NSLineBreakByWordWrapping;
    self.centerLabel.numberOfLines=1;
    self.centerLabel.textAlignment=NSTextAlignmentCenter;
    self.centerLabel.textColor=[UIColor blackColor];
    [self addSubview:self.centerLabel];
    
    [self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.top.equalTo(self.mas_top).offset(20);
        make.width.equalTo(@50);
        make.bottom.equalTo(self);
    }];
    
    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self);
        make.width.equalTo(@50);
        make.bottom.equalTo(self);
        make.top.equalTo(self.mas_top).offset(20);
    }];
    
    [self.centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftButton.mas_right);
        make.right.equalTo(self.rightButton.mas_left);
        make.top.equalTo(self.mas_top).offset(20);
        make.bottom.equalTo(self);
    }];
    
    
}

@end
